'use strict';
//////////////////////////////////////////////////////////////////////////////
// 全局存储
// 旨在复现store全局状态管理
//////////////////////////////////////////////////////////////////////////////
function $globel () {
    function get(key) {
        var store = window.PROJECTXIANWEBNG || {};
        return angular.copy(store[key]);
    }
    function set(key, value) {
        var store = window.PROJECTXIANWEBNG || {};
        store[key] = value;
        window.localStorage.setItem("PROJECTXIANWEBNG", JSON.stringify(store));
    }
    function readDb() {
        try{
            var x = JSON.parse(window.localStorage.getItem("PROJECTXIANWEBNG")) || {};
            window.PROJECTXIANWEBNG = x;
        }catch(e){
            window.localStorage.setItem("PROJECTXIANWEBNG", '{}');
        }
    }
    function saveDb() {
    }
    readDb();
    this.$get = function(){ return this };
    this.get = get;
    this.set = set;
    this.saveDb = saveDb;
    this.readDb = readDb;
}
exports = module.exports = $globel;